<div class="content-section introduction " >
  <div>
    <span class="feature-title">系统管理 | <small>权限管理</small> </span>
  </div>
</div>
<div class="content-section implementation GridDemo report">
  <div class="ui-g">
    <div class="ui-g-4">
      <h4 style="margin-bottom: 15px;">组织</h4>
      <p-tree [value]="orgs" selectionMode="single" [(selection)]="selected" (onNodeExpand)="nodeExpand($event)"(onNodeSelect) = "NodeSelect($event)"></p-tree>
    </div>
    <div class="ui-g-8">
      <h4>{{ titleName }}</h4>
      <div class="ui-grid-row text_aligin_right">
        <button pButton type="button" class="btn_add" (click)="showRoleEdit()" label="新增" icon="fa-plus" [disabled]="canAdd"></button>
        <button pButton type="button" class="btn_add" (click)="showRoleDelete()" label="删除" icon="fa-close"></button>

        <div class="ui-widget-header" style="padding:4px 10px;border-bottom: 0 none">
          <i class="fa fa-search" style="margin:4px 4px 0 0"></i>
          <input #gb type="text" pInputText size="50" placeholder="查询">
        </div>

        <p-dataTable [value]="tableDatas"
                     [responsive]="true"  id="manageTable" [rows]="10" [paginator]="true" [rowsPerPageOptions]="[10,15,20]" [(selection)]="selectedRoles" [globalFilter]="gb">
          <!--<p-footer>-->
          <!--<p-paginator rows="10" totalRecords="120" [rowsPerPageOptions]="[10,20,30]" pageLinkSize="10"></p-paginator>-->
          <!--</p-footer>-->
          <p-column selectionMode="multiple" ></p-column>
          <p-column field="rid" header="编号" [sortable]="true"></p-column>
          <p-column field="name" header="角色" [sortable]="true"></p-column>
          <p-column field="remark" header="备注" [sortable]="true"></p-column>
          <p-column field="color" header="操作" [style]="{'width':'12vw'}">
            <ng-template let-datas="rowData" pTemplate="operator">
              <button pButton type="button"  (click)="showRoleEdit(datas)" label="编辑"  class="ui-button-info"></button>
              <button pButton type="button" *ngIf="datas.rid != '0001'" (click)="showRoleDelete(datas)" label="删除"  class="ui-button-info"></button>
              <button pButton type="button"  (click)="showJurEdit(datas,true)" label="编辑权限"  class="ui-button-info"></button>
              <button pButton type="button"  (click)="showJurEdit(datas,false)" label="查看权限"   class="ui-button-info"></button>
            </ng-template>
          </p-column>
          <ng-template pTemplate="emptymessage">
            当前没有数据
          </ng-template>
        </p-dataTable>
      </div>
    </div>
  </div>
</div>


<p-growl [(value)]="msgs"></p-growl>

<!-- 删除角色弹框 -->
<p-growl [(value)]="deletemsgs"></p-growl>
<p-dialog header="删除确认框" [(visible)]="showRoleDeleteMask" modal="modal" width="300" [responsive]="true">
  <p>{{deleteRoleTip}}</p>
  <p-footer>
    <button type="button" pButton icon="fa-check" (click)="deleteRole()" label="确定"></button>
    <button type="button" pButton icon="fa-close" (click)="showRoleDeleteMask=false" label="取消"></button>
  </p-footer>
</p-dialog>

<!-- 新增和编辑角色弹框 -->
<app-role-edit [currentOrg]="selectedNode" [state]="roleState" (closeRoleEdit)="closeRoleEdit($event)" (addRole)="addRole($event)" (updateRole)="updateRole($event)" *ngIf="showRoleEditMask"></app-role-edit>

<!-- 编辑权限弹框 -->
<app-jur-edit [currentOrg]="selectedRid" [state]="jurState" (closeJurEdit)="closeJurEdit($event)" (updateJur)="updateJur($event)" *ngIf="showJurEditMask"></app-jur-edit>

<!-- 查看权限弹框 -->
<app-jur-look [currentOrg]="lookRid" (closeJurLook)="closeJurLook($event)" *ngIf="showJurLookMask"></app-jur-look>
